# pylint: disable-msg=E1101
"""
@author: Sergiy Tsymbalyuk
"""

import logging

from pylons.i18n import lazy_ugettext as _

from repoze.what.plugins.pylonshq import ControllerProtector
from repoze.what.predicates import has_permission

from chowa.lib.site.crud import FlatCrudController
from chowa.model.organization import Subordination, Division

from hrms.lib.base import BaseController, render, Session

log = logging.getLogger(__name__)

@ControllerProtector(has_permission('site.administer.organization'))
class SubordinationController(FlatCrudController):
    __model__ = Subordination
    __columns__ = ['division', 'superior']
    __edit_columns__ = ['division', 'superior']
    __filters__ = {'division_id': (Division, 'district')}
    __main_heading__ = _('Structure')
